package ycl.important.controller.region;


import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.important.common.ApiResult;
import ycl.important.common.base.controller.BaseRegionController;
import ycl.important.entity.region.Area;
import ycl.important.service.region.AreaService;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 地区设置 前端控制器
 * </p>
 *
 * @author YCL
 * @since 2021-06-05
 */
@RestController
@RequestMapping("/region/area")
@Api(tags = "地区 - 地区")
@ApiSort(4)
public class AreaController extends BaseRegionController {

	@Resource
	private AreaService areaService;

	@Override
	public ApiResult<Area> getById(Long id) {
		return ApiResult.success(areaService.getById(id));
	}

	@Override
	public ApiResult<Area> getByCode(String code) {
		return ApiResult.success(areaService.getByCode(code, Area.class));
	}

	@Override
	public ApiResult<List<Area>> getByParentCode(String code) {
		return ApiResult.success(areaService.getByParentCode(code, Area.class));
	}
}

